using Rosetta.Runtime;
using System.Collections.Generic;
using UnityEngine;

public class MainWindow : MonoBehaviour
{
    public List<ActorInfoWindow> Actors = new List<ActorInfoWindow>();

    // Start is called before the first frame update
    private void Start()
    {
        Refresh(Rosetta.Runtime.Rosetta.Locale);
        for (var i = 0; i < Main.Self.DB.Actors.Count; i++)
        {
            var actor = Actors[i];
            actor.Level.text = Main.Self.DB.Actors[i].Level.ToString();
            actor.Character.sprite = Main.Self.DB.Actors[i].Character;
        }
        Rosetta.Runtime.Rosetta.LocaleChanged += Refresh;
    }

    private void Refresh(LangFlag _)
    {
        for (var i = 0; i < Main.Self.DB.Actors.Count; i++)
        {
            Actors[i].Name.text = Rosetta.Runtime.Rosetta.GetText(Main.Self.DB.Actors[i].Name, "database");
        }
    }
}